'use client'; import { useState } from 'react'; import type { Chat } from '@/types/chat'; import { useParams } from 'next/navigation' import { useQuery } from '@tanstack/react-query'; import { getChat } from '@/app/api/user/chatService'; const ChatPage: React.FC = () => { const params = useParams() const chatID = Number(params.chatID); const {data:chat, error, isLoading} = useQuery({ queryKey: ["getChat"], queryFn: () => getChat(chatID) }) const [enabled, setEnabled] = useState(false); if(isLoading){ return

Loading...

} if(error){ return

Loading...

} return (
{/* Header */}
Profile

{}

{chat?.persona?.role}

Live Offline
{/* Chat messages */}
{chat?.chatList.map((msg, index) => (

{msg.self ? 'Visitor' : 'Ruccan Chat'}

{msg.text}
{msg.time}
))}
{/* Input area */}
); }; export default ChatPage;